package com.design.mode.abstractfactory;

/**
 * @Date 2023/3/29 14:09:36
 * @Author luopeng
 */
public class FactoryProducer {
    public static AbstractFactory getFactory(String factoryName){

        if (ShapeFactory.class.getSimpleName().equalsIgnoreCase(factoryName)) {
            return new ShapeFactory();
        } else if (ColorFactory.class.getSimpleName().equalsIgnoreCase(factoryName)) {
            return new ColorFactory();
        }
        throw new IllegalArgumentException("The factory don't have the factory of " + factoryName);
    }
}
